//exceptions:
//date
package com.ibm.eg.cvmanager.business.layer;

import java.util.ArrayList;

import com.ibm.eg.cvmanager.business.interfaces.ApplicantBusiness;
import com.ibm.eg.cvmanager.dao.impl.ApplicantDao;
import com.ibm.eg.cvmanager.dao.impl.InterviewDao;
import com.ibm.eg.cvmanager.dto.Applicant;

import exception.TechnicalException;

public class ApplicantBusinessImpl implements ApplicantBusiness {

	@Override
	public void addApplicant(Applicant applicant) {
		// TODO Auto-generated method stub
		ApplicantDao x = new ApplicantDao();
		try{
			x.beginTransaction();
			x.add(applicant);
			x.commitTransaction();
		}
		catch(Exception re)
		{
			x.rollbackTransaction();
		}
	}
	@Override
	public void updateApplicant(Applicant applicant) {
		// TODO Auto-generated method stub
		ApplicantDao x = new ApplicantDao();
		try{
			x.beginTransaction();
			x.add(applicant);
			x.commitTransaction();
		}
		catch(Exception re)
		{
			x.rollbackTransaction();
		}

	}

	@Override
	public void deleteApplicant(int applicantId) {
		// TODO Auto-generated method stub
		Applicant app =new Applicant();
		app.setId(applicantId);
		ApplicantDao x = new ApplicantDao();
		try{
			x.beginTransaction();
			x.delete(app);
			x.commitTransaction();
		}
		catch(Exception re)
		{
			x.rollbackTransaction();
		}
	}

	@Override
	public ArrayList<Applicant> filterApplicants(String name) throws TechnicalException {
		// TODO Auto-generated method stub
		ApplicantDao x = new ApplicantDao();
		ArrayList<Applicant> l = new ArrayList<Applicant>();
		l=x.filterApplicants(name);
		return l;
	}

	@Override
	public Applicant getApplicant(int id) {
		// TODO Auto-generated method stub
		return null;
	}
	

}
